package com.yjt.fresh.adpater;

import android.content.Context;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.jude.easyrecyclerview.adapter.BaseViewHolder;
import com.jude.easyrecyclerview.adapter.RecyclerArrayAdapter;
import com.yjt.fresh.R;
import com.yjt.fresh.bean.BeanClass;

/**
 * Created by gxcheng on 2018/1/13.
 */

public class AdpHomeClass extends RecyclerArrayAdapter<BeanClass> {
    public AdpHomeClass(Context context) {
        super(context);
    }

    @Override
    public BaseViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) {
        return new ClassViewHolder(parent);
    }

    class ClassViewHolder extends BaseViewHolder<BeanClass>{

        private ImageView mMenuIconIv;
        private TextView mMenuTitleTv;

        public ClassViewHolder(ViewGroup parent) {
            super(parent, R.layout.uc_home_class);
            mMenuIconIv=$(R.id.uc_class_icon_iv);
            mMenuTitleTv=$(R.id.uc_class_title_tv);
        }

        @Override
        public void setData(BeanClass data) {
            super.setData(data);
            Glide.with(getContext())
                    .load(data.getCOVER_IMG())
                    .placeholder(R.mipmap.defaul_image)
                    .into(mMenuIconIv);
            mMenuTitleTv.setText(data.getTITLE());
        }
    }
}
